package com.megvii.koala.tv.data;

import android.content.Context;

import com.megvii.corelib.util.FileUtil;
import com.megvii.corelib.util.SharedPreferenceTool;

/**
 * 用于记录本地主题视频文件信息
 * Created by taozheng on 16/4/5.
 */
public class TVFileManager {
    private static String KEY_LOCAL_FILE_PATH = "KEY_LOCAL_FILE_PATH";
    private String local_theme_path;
    private Context context;

    public void init(Context context) {
        this.context = context;
        local_theme_path = SharedPreferenceTool.getStringValueByKey(context, KEY_LOCAL_FILE_PATH, null);
    }

    public String getLocal_theme_path() {
        return local_theme_path;
    }

    public void setLocal_theme_path(String local_theme_path) {
        SharedPreferenceTool.saveStringValue(context, KEY_LOCAL_FILE_PATH, local_theme_path);
        this.local_theme_path = local_theme_path;
    }

    public boolean has_local_file(){
        //判断本地视频文件是否存在
        return FileUtil.isExists(local_theme_path);
    }
}
